
$(document).ready(function(){
	var rootPath = getRootPath();
	var userId = getQueryParamValue("userId");
	
	$.ajax({
		method : 'get',
		url : rootPath+'/maintain/api/v1/repairs?userId='+userId,
		error:function(XMLHttpRequest, ajaxOptions, thrownError){
			alert("连接服务器错误!");
		},
		success : function(resultData){
			
			var wholeHtml = '';
			
			$.each(resultData,function(maintainIndex,maintainObj){
				
				var maintainHtml = '';

				var resnId = maintainObj.resnId
			
				var color = '';
				
				if(maintainObj.status=='待确认'||maintainObj.status=='待养修'){
					color = '#F15C5C';
				}else if(maintainObj.status=='已养修'){
					color = '#76CBFF';
				}else{
					color = '#B7B7B7';
				}
				
				maintainHtml = maintainHtml   + '<div class="panel panel-default">'
				  							  +   '<a href="maintaininfor.html?resnId='+resnId+'" class="list-group-item clearfix">'
				  							  +     '<div style="width:70%;float:left" class="clearfix">'
				  							  + 	  '<p>'
				  							  + 	    '<div id="yj" style="width:30px;height:20px;background-color:#D60F25;float:left"><span style="color:white">'+ maintainObj.appointType +'</span></div>&nbsp;&nbsp;'
				  							  +			'<span style="font-family:黑体;font-size:15px;color:#B7B7B7">'+ maintainObj.oddNumber +'</span>'
				  							  +		  '</p>'
				  							  +		  '<div style="width:140%;height:1px;margin:0px auto;padding:0px;background-color:#E7E7E7;overflow:hidden;"></div>'
				  							  +		  '<br>'
				  							  +		    '<span style="font-family:黑体;font-size:13px">'+ maintainObj.modelName +'</span>'
				  							  +			'&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family:宋体;font-size:11px">'+ maintainObj.licenseNo +'</span>'
				  							  +		  '<br><br>'
				  							  +			'<span style="font-family:黑体;font-size:14px;color:#B7B7B7">预约时间：'+ maintainObj.reseApplStartTime +'</span>'
				  							  + 	'</div>'
				  							  + 	'<div style="width:20%;float:right">'
				  							  +  	  '<br><br>'
				  							  +		  '<br>'
				  						     // + 		'<span style="float:right" class="glyphicon glyphicon-chevron-right"></span>'
				  							  +        '<span class="biaoge-jt"></span>'
				  						      +		  '<br><br><br>'
				  							  + 		'<span style="font-family:黑体;font-size:13px;float:right;color:'+ color +'">'+ maintainObj.status +'</span>'
				  							  +		 '</div>'
				  							  + 	'</a>'
				  							  + '</div>'
				
				wholeHtml += maintainHtml;
			});
			
			$("#maintain").append(wholeHtml);
		}
	});
})
